package cn.jbolt.ai.core.chain.config;


import cn.jbolt.util.JSONUtil;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;

public class FuncCallNodeConfig  {

    /**
     * 调用的Function资源id
     */
    private String[] functions;

    /**
     * 结果输出字段
     */
    private String resultOutputField;

    /**
     * 匹配函数输出字段
     */
    private String matchFuncOutputField;

    /**
     * 是否输出到响应
     */
    private boolean outputToResponse = false;


    public static FuncCallNodeConfig from(JsonNode jsonNode) {
        FuncCallNodeConfig config = JSONUtil.toObject(jsonNode, FuncCallNodeConfig.class);


        return config;
    }

    //  转换为 JSON 字符串的方法
    public static ObjectNode getDefaultConfig() {
        FuncCallNodeConfig config = new FuncCallNodeConfig();
        return JSONUtil.toJsonObject(config);
    }



    public String[] getFunctions() {
        return functions;
    }

    public void setFunctions(String[] functions) {
        this.functions = functions;
    }

    public String getResultOutputField() {
        return resultOutputField;
    }

    public void setResultOutputField(String resultOutputField) {
        this.resultOutputField = resultOutputField;
    }

    public String getMatchFuncOutputField() {
        return matchFuncOutputField;
    }

    public void setMatchFuncOutputField(String matchFuncOutputField) {
        this.matchFuncOutputField = matchFuncOutputField;
    }

    public boolean isOutputToResponse() {
        return outputToResponse;
    }

    public void setOutputToResponse(boolean outputToResponse) {
        this.outputToResponse = outputToResponse;
    }
}
